#Include XInput.ahk

; Example: Control the vibration motors using the analog triggers of each controller.
XInput_Init()
Loop {
    Loop, 4 {
        if State := XInput_GetState(A_Index-1) {

            LT := State.bLeftTrigger
            RT := State.bRightTrigger
            wButtons := State.wButtons
            sThumbLX := State.sThumbLX
            sThumbLY := State.sThumbLY
            sThumbRX := State.sThumbRX
            sThumbRY := State.sThumbRY

            ;XInput_SetState(A_Index-1, LT*257, RT*257)
            ToolTip, bLeftTrigger: %LT%`nbRightTrigger: %RT%`nwButtons: %wButtons%`nsThumbLX: %sThumbLX%`nsThumbLY: %sThumbLY%`nsThumbRX: %sThumbRX%`nsThumbRY: %sThumbRY%
        }
    }
    Sleep, 100
}
XInput_Term()